From: Philip Chimento Date: Mon, 1 Jan 2024 00:13:25 +0000 (-0500) Subject: init: Improve error message formatting X-Git-Tag: archive/raspbian/50.5-1+rpi1~1^2~281^2~2^2~182 X-Git-Url: https://dgit.raspbian.org/%22http://www.example.com/cgi/%22/%22http:/www.example.com/cgi/%22?a=commitdiff_plain;h=1692004b6bb4cf03f46f973c7e2042e0495bcbd3;p=gnome-shell.git init: Improve error message formatting Instead of manually formatting the error message and stack, use the same formatting mechanism as we do when displaying errors to the user that occur while opening extension preferences. This should correctly indicate where syntax errors from imported modules occur. Part-of: --- diff --git a/js/ui/init.js b/js/ui/init.js index a7cf7db3e..735a367bb 100644 --- a/js/ui/init.js +++ b/js/ui/init.js @@ -2,6 +2,7 @@ import GLib from 'gi://GLib'; import Gio from 'gi://Gio'; import './environment.js'; +import {formatError} from '../misc/errorUtils.js'; // Run the Mutter main loop after // GJS finishes resolving this module. @@ -10,8 +11,7 @@ imports._promiseNative.setMainLoopHook(() => { GLib.idle_add(GLib.PRIORITY_DEFAULT, () => { import('./main.js').then(main => main.start()).catch(e => { const error = new GLib.Error( - Gio.IOErrorEnum, Gio.IOErrorEnum.FAILED, - `${e.message}\n${e.stack}`); + Gio.IOErrorEnum, Gio.IOErrorEnum.FAILED, formatError(e)); global.context.terminate_with_error(error); }); return GLib.SOURCE_REMOVE;